package com.electron.power.aio.mod.str;

import java.util.HashMap;
import java.util.Map;

import org.smartboot.socket.MessageProcessor;
import org.smartboot.socket.StateMachineEnum;
import org.smartboot.socket.transport.AioSession;
import org.springframework.stereotype.Component;

import lombok.extern.slf4j.Slf4j;

@Component
@Slf4j
public class FlinkModProcessor implements MessageProcessor<String> {
	
	public static Map<String,AioSession<String>> sessionMap = new HashMap<>();
	
	public static final String  CLIENT_SESSION_NAME= "flinkClientSession";

	@Override
	public void process(AioSession<String> session, String msg) {
		//接收客户端数据.
		log.info("flink 回复:{}",msg);
	}

	@Override
	public void stateEvent(AioSession<String> session, StateMachineEnum stateMachineEnum, Throwable throwable) {
		switch (stateMachineEnum) {
		case NEW_SESSION:
			sessionMap.put(CLIENT_SESSION_NAME, session);
			break;
		default:
			log.info("other state:" + stateMachineEnum);
		}
	}

}
